/**
 * 表结构：EMPLOYEE (NAME, AGE, SALARY, CODES, IDENTITY)
 */

import { ActionState, getErrorInfo, _appError, _appInfo } from "CoffeeSdk";


const SQL_CREATE_TABLE =
  'CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB, IDENTITY UNLIMITED INT)';


export function executePromiseWithLog(p: Promise<any>, fileName: string, funName: string) {
  p.then(() => {
    _appInfo(fileName, funName, "", ActionState.Fin);
  })
    .catch((e) => {
      // lastError = e;
      _appError(fileName, funName, "", ActionState.Fail, getErrorInfo(e));
    })
}